{
 "metadata": {
  "name": "BeamSplitingCube"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from pyoptools.all import *\n",
      "\n",
      "# Definition of the ray sources at the origin\n",
      "\n",
      "# Blue\n",
      "r_b= parallel_beam_c(size=(10,10),num_rays=(10,10), wavelength=.470)\n",
      "\n",
      "N_BK7=schott['BK7']\n",
      "\n",
      "bs=BeamSplitingCube(size=50,material=N_BK7,reflectivity=0.5)\n",
      "\n",
      "#Definition of a detector plane\n",
      "\n",
      "ccd=CCD(size=(20, 20))\n",
      "\n",
      "\n",
      "# Place de detectors at the focal planes of the lenses\n",
      "\n",
      "os=System(complist=[(bs,(0,0,50),(0,0,0)),\n",
      "                    (ccd,(0,0,100),(0,0,0)),\n",
      "                    ],n=1)\n",
      "\n",
      "\n",
      "#Add the ray sources\n",
      "os.ray_add(r_b)\n",
      "\n",
      "#Propagate the rays\n",
      "os.propagate()\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nota: Hay que revisar las convenciones de las rotaciones para que queden\n",
        "\r",
        " consistentes en x,y,z. Me parece que hay un error en el signo de la \n",
        "\r",
        " rotacional rededor de alguno de los ejes. Modulo misc \n",
        "\r",
        "si no estoy mal el error esta en la rotacion respecto a los ejez Y y Z\n",
        "Hay que revisar la libreria de materiales material.py"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Loading component library"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Edmund  from files  ['/usr/local/lib/python2.7/dist-packages/pyoptools/raytrace/library/Edmund/SphOptics.cmp', '/usr/local/lib/python2.7/dist-packages/pyoptools/raytrace/library/Edmund/SphOptics1.cmp']\n"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stderr",
       "text": [
        "/usr/lib/pymodules/python2.7/matplotlib/__init__.py:890: UserWarning:  This call to matplotlib.use() has no effect\n",
        "because the the backend has already been chosen;\n",
        "matplotlib.use() must be called *before* pylab, matplotlib.pyplot,\n",
        "or matplotlib.backends is imported for the first time.\n",
        "\n",
        "  if warn: warnings.warn(_use_error_msg)\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "glPlotFrame(os)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "pyout",
       "prompt_number": 2,
       "text": [
        "<pyoptools.gui.glplotframe2.glPlotFrame; proxy of <Swig Object of type 'wxFrame *' at 0x67b59c0> >"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "spot_diagram(ccd)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 3
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}